import React from 'react'
import { Button, Popconfirm, message } from "antd"

interface IDeleteProps {
  id: number
  callback: (id:number) => void
}
function Delete({id,callback}:IDeleteProps):JSX.Element {
  const confirm=()=>{
    callback(id);
    message.success("删除成功")
  }
  const cancel=()=>{
    message.info("取消移除")
  }
  return (
    <Popconfirm
      title="Are you sure to delete this task?"
      onConfirm={confirm}
      onCancel={cancel}
      okText="Yes"
      cancelText="No"
    >
      <Button type="primary" danger>删除</Button>
    </Popconfirm>
  )
}

export default Delete